from django.db import models
from django.contrib.auth.models import AbstractUser


class User(AbstractUser):
    """自定义用户模型类"""
    GENDER_CHOICES = (
        ('0', "男"),
        ('1', "女"),
        ('2', "保密"))
    Status_CHOICES = (
        ('0', "高级管理员"),
        ('1', "普通管理员"),
        ('2', "财务"),
        ('3', "老师"),
        ('4', "销售员"),
        ('5', "助教"),
        ('6', "普通用户"))
    mobile = models.CharField(max_length=11, unique=True, verbose_name='手机号')
    active = models.CharField(max_length=6, default="0", verbose_name='用户的级别')
    gender = models.CharField(max_length=6, choices=GENDER_CHOICES, default="2", verbose_name="性别")
    images_url = models.CharField(max_length=255,
                                  default="http://images.zyntt.cn/timg.png",
                                  verbose_name="头像")
    open_id = models.CharField(max_length=255, null=True, blank=True, verbose_name="绑定的微信号的open_id")

    class Meta:
        db_table = 'tb_users'
        verbose_name = '用户'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.username
